﻿@using CodeCamp.Infrastructure.Extensions
@using CodeCamp.Models.Schedule
@model ScheduleAddSessionModel

@using (Html.BeginForm("EditSchedule", "Schedule"))
{
    @Html.HiddenFor(model => model.SessionAddAction)
<table class="scheduleSession">
    <tr><td>Choose one session to add</td><td>Choose a timeslot and room</td></tr>
    <tr>
        <td>
            <table id="unscheduledSessions">
            <tr>
                <td>Status</td>
                <td>Des. Room Size</td>
                <td>Title</td>
            </tr>
    @foreach (var session in Model.UnscheduledSessions)
    {
        <tr>
        <td>@session.Status.ToString()</td>
        <td>@session.DesiredRoomSize</td>
        <td>
        @{
        var itemId = string.Format("unschedSesId_{0}", session.SessionId);
        @Html.RadioButtonFor(model => model.SessionId, session.SessionId, new { id = itemId })
        <label for="@itemId">
        @Html.ActionLink(session.Title.TruncateWithElipses(80), "Details", "Sessions", new { eventName = Model.EventShortName, id = session.SessionId }, null)
        </label>
        }
        </td>    
        </tr>
    }
            </table>
        </td>
        <td>
            @Html.LabelFor(model => model.RoomId, "Room")<br />
            @Html.DropDownListFor(
                x => x.RoomId,
                new SelectList(Model.Rooms, "RoomId", "Name"),
                "-- Select Room --"
                )<br />
            @Html.LabelFor(model => model.TimeslotId, "Timeslot")<br />
            @Html.DropDownListFor(
                x => x.TimeslotId,
                new SelectList(Model.Timeslots, "TimeslotId", "Name"),
                "-- Select Timeslot --"
                )
        </td>
    </tr>
    <tr>
        <td colspan="2">
    @Html.ValidationMessageFor(m => m.SessionId)
    @Html.ValidationSummary(false, "")
        </td>
    </tr>
    <tr>
        <td colspan="2">
    <input id="ScheduleSession" type="submit" name="submit" value="Schedule Session" />
        </td>
    </tr>
</table>    
    
}